package com.loanpcase;

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPOutputStream;

import org.apache.commons.codec.binary.Base64;

import com.util.HttpSend;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;

public class RLDJ0001 extends LPCase{


	@Override
	protected String getRequestUrl() {
		return "/RLMS/RLDJ0001";
	}

	@Override
	protected Map<String,Object> getRequestData(){
		HashMap<String,Object> REQUESTDATA = new HashMap<String, Object>();
		REQUESTDATA.put("REQSYSID","501");
		REQUESTDATA.put("PLATID","000");
		REQUESTDATA.put("DOCKING_ORGNO","00033");
		REQUESTDATA.put("COOPER_CODE","90001");
//		REQUESTDATA.put("APPLY_NO", "AL153362532439300000000000000000");
		REQUESTDATA.put("APPLY_NO", StringUtils.rightPad("AL"+System.currentTimeMillis(),32,"0"));
		REQUESTDATA.put("BANK_NO","03206");
		REQUESTDATA.put("PRD_CODE","PLAB");
		REQUESTDATA.put("PROJECT_NO","");
		REQUESTDATA.put("CUS_NAME","测试客户01");
		//REQUESTDATA.put("CUS_NAME","TESTCST");
		REQUESTDATA.put("CER_TYPE","03");
		REQUESTDATA.put("CER_NO","40432003420234");
		REQUESTDATA.put("CELLPHONE","13505037748");
		REQUESTDATA.put("PERMNT_ADDR_ZIPCODE","511440");
		REQUESTDATA.put("EMPLOYER","EMPLOYER");
		REQUESTDATA.put("OFFICE_AREA_CODE","");
		REQUESTDATA.put("OFFICE_NUMBER","503990");
		REQUESTDATA.put("OFFICE_ZIPCODE","511030");
		REQUESTDATA.put("MONTHLY_INCOME","1234567890.120");
		REQUESTDATA.put("FAMILY_MONTHLY_INCOME","10000000");
		REQUESTDATA.put("PURCHASE_PRICE","1000000");
		REQUESTDATA.put("HOUSE_AREA","80");
		REQUESTDATA.put("LOAN_CURRENCY","CNY");
		REQUESTDATA.put("DOWN_PAYMENT","300000");
		REQUESTDATA.put("LOAN_AMOUNT","700000");
		REQUESTDATA.put("LOAN_PERIOD","360");
		REQUESTDATA.put("PAYEE","");
		REQUESTDATA.put("PAYEE_DEBIT_CARD_NO","");
		REQUESTDATA.put("REPAYMENT_DEBIT_CARD_NO","");
		REQUESTDATA.put("FOUND_LOAN_AMNOUT","");
		REQUESTDATA.put("REF_APPLY_NO","");
		REQUESTDATA.put("COLLATERAL_ADDR","");
		REQUESTDATA.put("MORTGAGE_AREA","");
		REQUESTDATA.put("PROPERTY_DESC","");
		REQUESTDATA.put("REL_NUM","5");
		REQUESTDATA.put("FILLER1","FILLER1");
		REQUESTDATA.put("FILLER2","FILLER2");
		REQUESTDATA.put("FILLER3","FILLER3");
		REQUESTDATA.put("FILLER4","FILLER4");
		REQUESTDATA.put("FILLER5","FILLER5");
		//REQUESTDATA.put("CUSTOMER_MANAGER","9999999");
		Map<String,Object> relmap = new HashMap<>();
		REQUESTDATA.put("RELS",relmap);
		relmap.put("REL",getRelates(1));
		return REQUESTDATA;
		
	}

	public List<Map<String,String>> getRelates(int num){
		List<Map<String,String>> rl = new ArrayList<>();
		for(int i=0;i<num;i++){
			Map<String,String> relateMap = new HashMap<>();
			relateMap.put("REL_TYPE", "001"+(4+i));
			relateMap.put("REL_SOCIAL_REL", "000"+(2+i));
			relateMap.put("REL_NAME", "REL_NAME"+i);
			relateMap.put("REL_CERT_TYPE", "03");
			relateMap.put("REL_CERT_NO", "44029992348999223"+i);
			relateMap.put("REL_CELLPONE", "1342245542"+i);
			relateMap.put("REL_ADDR_ZIPCODE", "34232");
			relateMap.put("REL_EMPLOYER", "REL_EMPLOYER");
			relateMap.put("REL_OFFICE_AREA_CODE", "2143324");
			relateMap.put("REL_OFFICE_NUMBER", "2131242312");
			relateMap.put("REL_OFFICE_ZIPCODE", "3423");
			relateMap.put("MON_INCOME", "13232");
			relateMap.put("FAM_ILYOTSALARY", "45234234");
			rl.add(relateMap);
		}
		return rl;
	}

	static public void main(String[] args){
//		new RLDJ0001().run("http://127.0.0.1:11003/loanproxy");
	//new RLDJ0001().run(Config.TEST_CONTEXT_URL_1601);
		new RLDJ0001().run("http://127.0.0.1:11008/loanproxy");
	}

}
